var t = require("../../../../@babel/runtime/helpers/objectSpread2"), e = require("../../../../common/vendor.js"), n = require("../function/index.js"), i = require("../function/test.js"), r = require("../util/route.js"), u = require("../function/debounce.js"), o = require("../function/throttle.js"), a = {
    props: {
        customStyle: {
            type: [ Object, String ],
            default: function() {
                return {};
            }
        },
        customClass: {
            type: String,
            default: ""
        },
        url: {
            type: String,
            default: ""
        },
        linkType: {
            type: String,
            default: "navigateTo"
        }
    },
    data: function() {
        return {};
    },
    onLoad: function() {
        this.$uv.getRect = this.$uvGetRect;
    },
    created: function() {
        this.$uv.getRect = this.$uvGetRect;
    },
    computed: {
        $uv: function() {
            var a, c, s;
            return t(t({}, n.index), {}, {
                test: i.test,
                route: r.route,
                debounce: u.debounce,
                throttle: o.throttle,
                unit: null == (s = null == (c = null == (a = e.index) ? void 0 : a.$uv) ? void 0 : c.config) ? void 0 : s.unit
            });
        },
        bem: function() {
            return function(t, e, n) {
                var i = this, r = "uv-".concat(t, "--"), u = {};
                return e && e.map(function(t) {
                    u[r + i[t]] = !0;
                }), n && n.map(function(t) {
                    i[t] ? u[r + t] = i[t] : delete u[r + t];
                }), Object.keys(u);
            };
        }
    },
    methods: {
        openPage: function() {
            var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "url", n = this[t];
            n && e.index[this.linkType]({
                url: n
            });
        },
        $uvGetRect: function(t, n) {
            var i = this;
            return new Promise(function(r) {
                e.index.createSelectorQuery().in(i)[n ? "selectAll" : "select"](t).boundingClientRect(function(t) {
                    n && Array.isArray(t) && t.length && r(t), !n && t && r(t);
                }).exec();
            });
        },
        getParentData: function() {
            var t = this, e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "";
            this.parent || (this.parent = {}), this.parent = this.$uv.$parent.call(this, e), 
            this.parent.children && -1 === this.parent.children.indexOf(this) && this.parent.children.push(this), 
            this.parent && this.parentData && Object.keys(this.parentData).map(function(e) {
                t.parentData[e] = t.parent[e];
            });
        },
        preventEvent: function(t) {
            t && "function" == typeof t.stopPropagation && t.stopPropagation();
        },
        noop: function(t) {
            this.preventEvent(t);
        }
    },
    onReachBottom: function() {
        e.index.$emit("uvOnReachBottom");
    },
    beforeDestroy: function() {
        var t = this;
        if (this.parent && i.array(this.parent.children)) {
            var e = this.parent.children;
            e.map(function(n, i) {
                n === t && e.splice(i, 1);
            });
        }
    },
    unmounted: function() {
        var t = this;
        if (this.parent && i.array(this.parent.children)) {
            var e = this.parent.children;
            e.map(function(n, i) {
                n === t && e.splice(i, 1);
            });
        }
    }
};

exports.mixin = a;